/*
 * Copyright (c) 2010-2011 Josef Hardi <josef.hardi@gmail.com>
 * Copyright (c) 2010 Piotr Zagawa <piotr.zagawa@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package id.duapuluhdua.dakidaki.loader;

import id.duapuluhdua.dakidaki.MainState;
import id.duapuluhdua.dakidaki.Preferences;
import id.duapuluhdua.dakidaki.common.CommonActivity;
import id.duapuluhdua.dakidaki.data.common.Database;
import id.duapuluhdua.dakidaki.layers.Layer;
import id.duapuluhdua.dakidaki.map.Screen;

/**
 *
 */
public abstract class LoaderItem
{
  /** Fields */
  protected CommonActivity mParent;
  protected Screen mScreen;
  protected Database mDatabase;
  protected MainState mState;
  protected Preferences mPreference;

  private long itemId = -1;

  /**
   * The default constructor.
   *
   * @param parent the application main activity.
   * @param screen the screen object.
   * @param database the database object.
   * @param itemId the item id.
   */
  public LoaderItem(CommonActivity parent, Screen screen, Database database, long itemId)
  {
    mParent = parent;
    mScreen = screen;
    mDatabase = database;
    mState = parent.getMainState();
    mPreference = parent.getPrefs();

    this.itemId = itemId;
  }

  /**
   * Retrieves the item that is currently being loaded.
   *
   * @return the id number.
   */
  public long getId()
  {
    return itemId;
  }

  public abstract boolean reload();

  public abstract boolean isSelected();

  public abstract Layer getLayer();

  public abstract String getDescription();
}
